package transport;

public class Constants {

	/**
	 * The bit length of a port field
	 */
	public static final int PORT_LENGTH = 4;
	/**
	 * The maximum integer value of a port field
	 */
	public static final int PORT_MAX = (int) (Math.pow(2, PORT_LENGTH) - 1);

	/**
	 * The bit length of the sequence number field
	 */
	public static final int SEQUENCE_NUMBER_LENGHT = 8;
	/**
	 * The maximum integer value of a window
	 */
	public static final int MAX_WINDOW = (int) ((Math.pow(2,
			SEQUENCE_NUMBER_LENGHT) / 2) - 1);
	/**
	 * The agreed length of the window
	 */
	public static final int WINDOW = 8;
	/**
	 * The maximum integer value of a sequence number
	 */
	public static final int MAX_SEQUENCE_NUMBER = (int) (Math.pow(2,
			SEQUENCE_NUMBER_LENGHT));

	/**
	 * The maximum packet size (including headers) in bytes
	 */
	public static final int MAX_PACKET_LENGTH = 48;
	/**
	 * The length of the headers of a Transport packet in bytes
	 */
	public static final int HEADER_LENGTH = 8;
	/**
	 * The maximum length of the payload in bytes
	 */
	public static final int MAX_PAYLOAD_LENGTH = MAX_PACKET_LENGTH
			- HEADER_LENGTH;
	/**
	 * Command that the application gives if it wants to shut down the
	 * connection
	 */
	
	public static final int DISCONNECT_THRESHOLD = 10;

	/**
	 * The timeout value of the Transport Layer
	 */
	public static final int TIMEOUT_VALUE = 4000;
	// INTERN PROTOCOL
	public static final String DISCONNECT = "disconnect";
	/**
	 * Command that the transport layer gives if the other end of the connection
	 * has shut down the connection
	 */
	public static final String DISCONNECTED = "disconnected";
	/**
	 * Command that the application gives if it wants to connect
	 */
	public static final String CONNECTING = "connecting";
	/**
	 * Command that the transport layer gives if a connection is set up
	 */
	public static final String CONNECTED = "connected";
	/**
	 * Command that the application layer gives if it wants to listen to
	 * incoming connections
	 */
	public static final String LISTEN = "listen";

}
